package edu.neu.swc.commerce.controller;

import edu.neu.swc.commerce.stream.DefaultSendService;
import edu.neu.swc.commerce.stream.qinyi.QinyiSendService;
import edu.neu.swc.commerce.vo.QinyiMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <h1>构建消息驱动</h1>
 */
@RestController
@RequestMapping("/message")
public class MessageController {

    private final DefaultSendService defaultSendService;

    private final QinyiSendService qinyiSendService;

    public MessageController(DefaultSendService defaultSendService, QinyiSendService qinyiSendService) {
        this.defaultSendService = defaultSendService;
        this.qinyiSendService = qinyiSendService;
    }

    /**
     * <h2>默认信道</h2>
     */
    @GetMapping("/default")
    public void defaultSend(){
        defaultSendService.sendMessage(QinyiMessage.defaultMessage());
    }

    @GetMapping("/qinyi")
    public void qinyiSend(){
        qinyiSendService.sendMessage(QinyiMessage.defaultMessage());
    }
}
